﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestScroll : MonoBehaviour
{
    public RectTransform testScroll;

    public RectTransform[] prefabs;

    // Start is called before the first frame update
    void Start()
    {
        var unScroll = testScroll.GetComponent<UnlimitedScroll>();
        unScroll.SetItemFunc(GetItemByIndex);
        unScroll.InitScroll();
    }

    RectTransform GetItemByIndex(int index, Transform parent)
    {
        if (index > 30)
        {
            return null;
        }
        int realIndex = index % 3;
        var item = Instantiate<RectTransform>(prefabs[realIndex], parent);
        return item;
    }
}
